﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Gadgets.Orders
{
	public partial class eInvestors : WeifenLuo.WinFormsUI.Docking.DockContent  
	{
		public eInvestors()
		{
			InitializeComponent();
		}
		
		private void eInvestors_Load(object sender, EventArgs e)
		{
			try
			{
                ABSCommonLibrary.CreateGridView(ref gridControl1);
                colOPEN_DATE.FormatSpecifier = DeclareLibrary.DATE_DISPLAY_FORMAT;
                colCLOSE_DATE.FormatSpecifier = DeclareLibrary.DATE_DISPLAY_FORMAT;
                colBIRTHDAY.FormatSpecifier = DeclareLibrary.DATE_DISPLAY_FORMAT;
                colCARD_DATE.FormatSpecifier = DeclareLibrary.DATE_DISPLAY_FORMAT;
                colFOUNDATION_DATE.FormatSpecifier = DeclareLibrary.DATE_DISPLAY_FORMAT;
                colOPERATION_DATE.FormatSpecifier = DeclareLibrary.DATE_DISPLAY_FORMAT; 
			}
			catch (Exception ex)
			{
				ABSCommonLibrary.ShowErrorMessage(ex.ToString());
			}
		}

		private void load_grid()
		{
			string account_no = string.Empty;			
			string status = string.Empty;
            if (valueRow1.Cells["ACCOUNT_NO"].Value != null)
                account_no = valueRow1.Cells["ACCOUNT_NO"].Value.ToString();
            if (valueRow1.Cells["STATUS"].Value != null)
                status = valueRow1.Cells["STATUS"].Value.ToString();

            DataSet v_data = ABSCommonLibrary.DoInquiry(
                CommonLibrary.CommonLibrary.BOSC006006, new object[2] { account_no, status });
            gridControl1.SetDataBinding(v_data, v_data.Tables[0].TableName);
		}

        private void eInvestors_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F9)
                {
                    load_grid();
                }
            }
            catch (Exception ex)
            {
                ABSCommonLibrary.ShowErrorMessage(ex.ToString()); 
            }
            
        }
		
	}
}